package com.bianguo.zsd.SpringBootDemo.utils;

import com.bianguo.zsd.SpringBootDemo.bean.BaseEntity;

public class ResultUtils {

    public static <T> BaseEntity<T> success(T data) {
        BaseEntity<T> baseEntity = new BaseEntity<>();
        baseEntity.setStatus(200);
        baseEntity.setMsg("数据请求成功");
        baseEntity.setData(data);
        return baseEntity;
    }

    public static BaseEntity success() {
        return success(null);
    }

    public static BaseEntity error(Integer status, String msg) {
        BaseEntity baseEntity = new BaseEntity();
        baseEntity.setStatus(status);
        baseEntity.setMsg(msg);
        return baseEntity;
    }
}
